package chat.activities;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;

import com.whu.administrator.ws.R;
import com.whu.administrator.ws.UIHandler;


/**
 * 查看群组内的用户
 * Created by 凯 on 2015/11/15.
 */
public class GroupUsersActivity extends UIHandler.BaseActivity{

    long group_id;

    Button btn_back;
    ListView lv_users;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_groupusers);
        initdata();
        initview();
    }

    private void initdata() {
        group_id = getIntent().getLongExtra("groupId",0);
    }

    View.OnClickListener itemclick = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v == btn_back)
            {
                finish();
            }
        }
    };

    // 初始化界面
    private void initview() {
        btn_back = (Button) findViewById(R.id.id_btn_back);
        btn_back.setOnClickListener(itemclick);
        lv_users = (ListView) findViewById(R.id.id_lv_users);

        lv_users.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {

                return true;
            }
        });

//        if (group_id != 0L)
//        new GetGroupusers(this,new GetGroupusers.Upload(group_id+"")).get();
    }

    // 获取下载数据后
//    @Override
//    public void onResponse(String response, GetGroupusers getGroupusers) {
//        if (getGroupusers.getDownload().getStatus() == DownloadInfo.SUCCESS)
//        {
//            groupUserAdapter = new GroupUserAdapter();
//            groupUserAdapter.setGetGroupusers(getGroupusers);
//            lv_users.setAdapter(groupUserAdapter);
//        }else if (getGroupusers.getDownload().getStatus() == DownloadInfo.FAILED)
//        {
//
//        }
//    }
//
//    @Override
//    public void onErrorResponse(VolleyError error, GetGroupusers getGroupusers) {
//
//    }
}
